<?php
// include the file containing initialization of the database and session
include('config.php');

// if the user is already logged in, he could not log in again
if(isset($_SESSION['username']))
{
	//render index
	$index_view = new Template('layout.php',
		array("logged_in" 	=> true,
			  "contents" 	=> "index_view.php"));
	$index_view->render();	
}
else // not logged in; show login form
{
	$index_view = new Template("login_view.php");
	$index_view->render();
}
?>